define([],function(){
    var tpl = {};

    tpl.init = function(){
        var html = '';
        html += tree();
        return html;
    };
    tpl.init2 = function(){
        var html = '';
        html += schemeDetail();
        return html;
    };
    tpl.init4 = function(){
        var html = '';
        html += schemeStages();
        return html;
    };
    tpl.init3 = function(){
        var html = '';
        html += stageCourses();
        return html;
    };
    tpl.init5 = function(){
        var html = '';
        html += courseList();
        return html;
    };

    var tree = function(){
        return  '<script id="nutrition_tree" type="text/html">'+
                '   {{each list as value i}}'+
                '       <li>'+
                '           <span>{{value.title}}</span>'+
                '           <ul>'+
                '               {{each value.child as value2,j}}'+
                '                   <li>'+
                '                       <span>{{value2.title}}</span>'+
                '                       {{if value2.child}}'+
                '                           <ul>'+
                '                               {{each value2.child as value3}}'+
                '                               <li>'+
                '                                   <span>{{value3.title}}</span>'+
                '                               </li>'+
                '                               {{/each}}'+
                '                           </ul>'+
                '                       {{/if}}'+
                '                   </li>'+
                '               {{/each}}'+
                '           </ul>'+
                '       </li>'+
                '   {{/each}}'+
                '</script>'
    };


    var schemeDetail = function(){
        return  '<script id="nutrition_schemeDetail" type="text/html">'+
                '   <label>方案名称：<span>{{schemeName}}</span></label>'+
                '   <label>计划使用时间：<span>{{days}}天</span></label>'+
                '   {{if schemeApply}}<label>适用人群：<span>{{schemeApply}}</span></label>{{/if}}'+
                '   {{if schemeDesc}}<label>营养目标：<span>{{schemeDesc}}</span></label>{{/if}}'+
                '</script>';
    };
    var schemeStages = function(){
        return  '<script id="nutrition_schemeStages" type ="text/html">'+
                '   {{each list as value i}}'+
                '       <span stageId="{{value.stageId}}" stageNo="{{value.stageNo}}">{{value.stageName}}</span>'+
                '   {{/each}}'+
                '</script>';
    };
    var stageCourses = function(){
        return  '<script id="nutrition_stageCourses" type="text/html">'+
                '        {{each list as value i}}'+
                '        <li courseNo="{{value.courseNo}}" stageCourseId="{{value.stageCourseId}}">'+
                '            <div class="platform-left">'+
                '                <span class="num">{{value.courseNo}}</span>'+
                '                <span class="name">{{value.courseName}}</span>'+
                '            </div>'+
                '            <div class="platform-right">'+
                '                <span class="upMoveCourse"><i class="fa fa-arrow-circle-up" aria-hidden="true"></i> 上移</span>'+
                '                <span class="downMoveCourse"><i class="fa fa-arrow-circle-down" aria-hidden="true"></i> 下移</span>'+
                '                <span class="delCourse"><i class="fa fa-trash" aria-hidden="true"></i> 删除</span>'+
                '            </div>'+
                '        </li>'+
                '        {{/each}}'+
                '</script>';
    };
    var courseList = function(){
        return  '<script id="nutrition_courseList" type="text/html">'+
                '   <select class="courses">'+
                '       {{each list as value i}}'+
                '           <option value="{{value.libraryId}}">{{value.libraryName}}</option>'+
                '       {{/each}}'+
                '   </select>'+
                '</script>'
    };

    return tpl;
});